fix: ReWOOReasoning.aplan() calls sync add_to_memory instead of async aadd_to_memory#185
fix: ReWOOReasoning.aplan() calls sync add_to_memory instead of async aadd_to_memory#185BhoomiAgrawal12 wants to merge 2 commits intomesa:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
CI is failing here because the async version awaits for the memory method, but some tests still treat it like a normal function. The tests fail when the code tries to await it so they should be updated to treat that method as async. |
04a6efb to
071161b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #185 +/- ##
=======================================
Coverage 90.64% 90.64%
=======================================
Files 19 19
Lines 1540 1540
=======================================
Hits 1396 1396
Misses 144 144 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Thanks! I have updated them. |
Pre-PR Checklist
Summary
ReWOOReasoning.aplan()was calling the synchronousadd_to_memory()directly instead ofawait self.agent.memory.aadd_to_memory().The
Memorybase class defines both:add_to_memory(): sync, does in-memory dict manipulationaadd_to_memory(): async, intended override point for subclassesIf a
Memorysubclass overridesaadd_to_memoryto do genuinely async work (async database write or async event emit), calling the sync method silently bypasses that override entirely without any error.All other reasoning classes (
CoTReasoning,ReActReasoning) already useawait aadd_to_memory()correctly in their async paths. ReWOO was the only one missing it.Bug / Issue
Fixes #184
Implementation
mesa_llm/reasoning/rewoo.py: replaced
self.agent.memory.add_to_memory(...)withawait self.agent.memory.aadd_to_memory(...)inaplan()tests/test_reasoning/test_rewoo.py: added
test_aplan_uses_async_memory_methodregression test that assertsaadd_to_memoryis awaited andadd_to_memoryis never called in the async path